<?php
/**
 * Page Template
 *
 * Main index page<br />
 * Displays greetings, welcome text (define-page content), and various centerboxes depending on switch settings in Admin<br />
 * Centerboxes are called as necessary
 *
 * @package templateSystem
 * @copyright Copyright 2003-2006 Zen Cart Development Team
 * @copyright Portions Copyright 2003 osCommerce
 * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
 * @version $Id: tpl_index_default.php 3464 2006-04-19 00:07:26Z ajeh $
 */
?>
<div class="centerColumn" id="indexDefault">
<!--<h1 id="indexDefaultHeading"><?php echo HEADING_TITLE; ?></h1> -->

<?php if (SHOW_CUSTOMER_GREETING == 1) { ?>
<h2 class="greeting"><?php echo zen_customer_greeting(); ?></h2>
<?php } ?>

<!-- deprecated - to use uncomment this section
<?php if (TEXT_MAIN) { ?>
<div id="" class="content"><?php echo TEXT_MAIN; ?></div>
<?php } ?>-->

<!-- deprecated - to use uncomment this section
<?php if (TEXT_INFORMATION) { ?>
<div id="" class="content"><?php echo TEXT_INFORMATION; ?></div>
<?php } ?>-->

<?php if (DEFINE_MAIN_PAGE_STATUS >= 1 and DEFINE_MAIN_PAGE_STATUS <= 2) { ?>
<?php
/**
 * get the Define Main Page Text
 */
?>
<div id="indexDefaultMainContent" class="content"><?php require($define_page); ?></div>
<?php } ?>



<table cellspacing="0" cellpadding="0" border="0">
  <tbody>
    <tr>
      <td class="l-top"><?php require(DIR_WS_MODULES.zen_get_module_directory('index_quick_search.php'));?></td>
      <td class="r-top">
              <?php
              if (SHOW_BANNERS_GROUP_SET1 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET1)) {
                if ($banner->RecordCount() > 0) {
      echo zen_display_banner('static', $banner);

                }
              }
?>
       
      </td>
    </tr>
    <tr>
    <td class="l-space">
 <?php 
 require($template->get_template_dir('tpl_modules_featured_products.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_featured_products.php');?>
    </td>
      
      <td class="r-space">
         <?php
              if (SHOW_BANNERS_GROUP_SET2 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET2)) {
                if ($banner->RecordCount() > 0) {
      echo zen_display_banner('static', $banner);

                }
              }
?>
      </td>
    </tr>
    <tr>

 <td class="l-space">
  <table cellspacing="0" cellpadding="0" border="0">
    <tbody>
      <tr>
        <td><?php echo zen_image(DIR_WS_TEMPLATE_IMAGES . 'comm_fm_header.gif'); ?></td>
      </tr>
      <tr>
        <td height="257" class="l-border">
          <table cellspacing="0" cellpadding="0" border="0">
            <tbody>
              <tr>
   <?php 
   //bof featured categories
$featured_categories_query = "select c.categories_id,c.categories_image, cd.categories_name,cd.categories_description
										 from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd
										 
										 where c.categories_id = cd.categories_id 
										 and c.categories_featured >0 
										 and c.categories_status =1
										 and cd.language_id = '" . (int)$_SESSION['languages_id'] . "'
										 order by  sort_order ,cd.categories_name";
										 //echo $featured_categories_query;
										 //exit;

$featured_categories = $db->Execute($featured_categories_query);
$count=0;
while (!$featured_categories->EOF and $count<4){
$acPath_new = zen_get_path($featured_categories->fields['categories_id']);   

    // strip out 0_ from top level cats
$acPath_new = str_replace('=0_', '=', $acPath_new);
$count++;
echo ' <td class="ftm-item-cell">
                  <div>
                    <a  href="' . zen_href_link(FILENAME_DEFAULT, $acPath_new) . '" title="'.$featured_categories->fields['categories_name'].'">
                     ' . zen_image(DIR_WS_IMAGES . $featured_categories->fields['categories_image'], $featured_categories->fields['categories_name'], 140, 116) . '
                    </a>
                  </div>
                  <div class="ftm-item-tle">
                        <a  href="' . zen_href_link(FILENAME_DEFAULT, $acPath_new) . '" title="'.$featured_categories->fields['categories_name'].'">
                  '. $featured_categories->fields['categories_name'] .'
                    </a>
                  </div>
                  <div class="ftm-item-desc">
                      '. $featured_categories->fields['categories_description'] .'                              
                  </div>
                  <div>
                   <a  href="' . zen_href_link(FILENAME_DEFAULT, $acPath_new) . '" title="'.$featured_categories->fields['categories_name'].'">'.zen_image(DIR_WS_TEMPLATE_IMAGES . 'shopnow.jpg').'
                    </a>
                  </div>
                </td>'  ;
  $featured_categories->MoveNext();
   }
   ?>             
                
                
               
				
				
              </tr>
            </tbody>
          </table>
        </td>
      </tr>
      <tr>
        <td><?php echo zen_image(DIR_WS_TEMPLATE_IMAGES . 'comm_fifm_bottom.gif'); ?></td>
      </tr>
    </tbody>
  </table>
</td>

      <td align="center" class="r-space"><div><img width="174" height="34" src="images/idx_news_header1.gif">
          <div class="news-border"><img width="162" height="166" border="0" src="images/idx_news_logo_2010jan.jpg"></div><img width="174" height="5" src="images/idx_news_frame_bottom.gif">
        </div>
        <div class="r-bottom-space">
        <?php
              if (SHOW_BANNERS_GROUP_SET3 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET3)) {
                if ($banner->RecordCount() > 0) {
      echo zen_display_banner('static', $banner);

                }
              }
?>
        
        </div></td>
    </tr>
    <tr>
    </tr>
    <tr>
      <td class="l-space" colspan="2">
      <?php require(DIR_WS_MODULES.zen_get_module_directory('top_search.php')); ?>
      </td>
    </tr>
  </tbody>
</table>





<?php
  $show_display_category = $db->Execute(SQL_SHOW_PRODUCT_INFO_MAIN);
  while (!$show_display_category->EOF) {
?>

<?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_MAIN_FEATURED_PRODUCTS') { ?>
<?php
/**
 * display the Featured Products Center Box
 */
?>
<?php  ?>
<?php } ?>

<?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_MAIN_SPECIALS_PRODUCTS') { ?>
<?php
/**
 * display the Special Products Center Box
 */
?>
<?php require($template->get_template_dir('tpl_modules_specials_default.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_specials_default.php'); ?>
<?php } ?>

<?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_MAIN_NEW_PRODUCTS') { ?>
<?php
/**
 * display the New Products Center Box
 */
?>
<?php require($template->get_template_dir('tpl_modules_whats_new.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_modules_whats_new.php'); ?>
<?php } ?>

<?php if ($show_display_category->fields['configuration_key'] == 'SHOW_PRODUCT_INFO_MAIN_UPCOMING') { ?>
<?php
/**
 * display the Upcoming Products Center Box
 */
?>
<?php include(DIR_WS_MODULES . zen_get_module_directory(FILENAME_UPCOMING_PRODUCTS)); ?><?php } ?>


<?php
  $show_display_category->MoveNext();
} // !EOF
?>
</div>